//头部的时间
function showDate() {
    const showTime = document.getElementById("showTime")
    showTime.innerText = moment().format("YYYY-MM-DD HH:mm:ss")
}
showDate();
setInterval(() => {
    showDate();
}, 1000)

//获取用户信息
let userInfo = JSON.parse(localStorage.getItem("userInfo"))[0]
//渲染用户名
const loginname = document.getElementById("loginname")
loginname.innerText = userInfo.nickname;
//渲染头像
const avatar = document.getElementById("avatar")
avatar.src = userInfo.url
//权限覆盖
localStorage.setItem("level", userInfo.level)

/**
 * @Description:  # TODO 退出登录
 * @Author: 文渊
 * @Date: 2023-09-05 14:09:17
 */
function logout() {
    const res = confirm("您确定要退出登录吗?")
    if (res) {
        //清除所有的localStorage里面的内容
        localStorage.clear();
        //跳转到登录页面
        location.href = "./login.html"
    }
}